#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    bool greater(int a, int b) {
        return a > b;
    }
    int small(int a, int b) {
        if (a > b) {
            return b;
        }
        else {
            return a;
        }
    }
    int len(int left, int right) {
        return right - left;
    }
    int maxArea(vector<int>& height) {
        int left = 0;
        int right = height.size() - 1;
        int max = len(left, right) * small(height[left], height[right]);
        while (left != right) {
            if (greater(height[left], height[right])) {
                right--;
            }
            else {
                left++;
            }
            int n = len(left, right) * small(height[left], height[right]);
            if (n > max) {
                max = n;
            }
        }
        cout << max;
    }
};
int main()
{
    Solution s1;
    vector<int> v1;
    v1.push_back(1);
    v1.push_back(8);
    v1.push_back(6);
    v1.push_back(2);
    v1.push_back(5);
    v1.push_back(4);
    v1.push_back(8);
    v1.push_back(3);
    v1.push_back(7);
    for (auto e : v1) {
        cout << e << ' ';
    }
    cout << endl;

	return 0;
}